# -*- coding: utf-8 -*-

import os


def get_screen_size():
    r = os.popen("adb shell wm size")  # 执行该命令
    info = r.readlines()  # 读取命令行的输出到一个list
    override_screen = None

    for line in info:  # 按行遍历
        line = line.strip("\r\n")
        index = line.index("size:") + 5
        size = line[index:].strip()
        screen = size.split("x")
        if "Override" in line:
            override_screen = screen

    if override_screen is None:
        return screen
    else:
        return override_screen


if __name__ == '__main__':
    screen = get_screen_size()
